package org.threads.threadpool.task;

import org.utils.Utils;

/**
 * Created by Oleksandr_Terekh on 9/1/2014.
 */
public class TaskImpl implements Task {

    private static final long MIN_PROC_TIME = 50;
    private static final long MAX_PROC_TIME = 150;

    private static int startId = 1;

    private int id;

    public TaskImpl() {
        this.id = startId++;
    }

    @Override
    public void performTask() throws InterruptedException {
        Thread.sleep(Utils.getRandom(MIN_PROC_TIME, MAX_PROC_TIME));
    }

    @Override
    public int getId() {
        return id;
    }

}
